using System;

namespace TBit {
    public enum DataType {
        Null,
        Number,
        Boolean,
        String,
        Function,
    }

    public class Function {
        public int start_address;
        public int end_address;
    }

    public class Data {
        public DataType type;
        public double number_data;
        public bool boolean_data;
        public string string_data; 
        public Function function_data;

        public Data() {type = DataType.Null;}
        public Data(double v) {
            type = DataType.Number;
            number_data = v;
        }

        public Data(bool v) {
            type = DataType.Boolean;
            boolean_data = v;
        }

        public Data(string v) {
            type = DataType.String;
            string_data = v;
        }

        public Data(Function func) {
            type = DataType.Function;
            function_data = func;
        }

        public override string ToString()
        {
            switch(type)
            {
                case DataType.Number : return number_data.ToString();
                case DataType.Boolean : return boolean_data.ToString();
                case DataType.String : return string_data;
                case DataType.Function : return "type(function)";
            }
            return "Null";
        }
    }
}